/**
 * @file ipeLenetParam.h
 * @author SDK_TEAM
 * @brief
 * @version 0.1
 * @date 2022-10-26
 *
 * Copyright:
 * © 2018 北京灵汐科技有限公司 版权所有。
 * 注意：以下内容均为北京灵汐科技有限公司原创，未经本公司允许，不得转载，否则将视为侵权；对于不遵守此声明或者其他违法使用以下内容者，本公司依法保留追究权。
 * © 2018 Lynxi Technologies Co., Ltd. All rights reserved.
 * NOTICE: All information contained here is, and remains the property of Lynxi. This file can not
 * be copied or distributed without the permission of Lynxi Technologies Co., Ltd.
 *
 */

#pragma once

#include "util.hpp"
#include <iostream>
#include <lyn_api.h>
#include "ipeParam.h"

class IpeParamLenet : IpeParamBase
{
public:
    IpeParamLenet(int iModelWidth, int iModelHeight) : IpeParamBase(iModelWidth, iModelHeight) {}
    ~IpeParamLenet() {}

    // IPE处理
    virtual void CalcParam(lynStream_t stream, void *inputData, void *outputData)
    {
        // 结构体reset
        CHECK_ERR(lynIpeResetPicDesc(m_oPicDescIn));
        CHECK_ERR(lynIpeResetPicDesc(m_oPicDescOut));
        CHECK_ERR(lynIpeResetConfigDesc(m_oConfigDesc));
        CHECK_ERR(
            lynIpeSetInputPicDesc(m_oPicDescIn, inputData, m_iImgWidth, m_iImgHeight, m_format));
        CHECK_ERR(lynIpeSetC2CConfig(m_oConfigDesc, LYN_PIX_FMT_GRAY8, 0));
        CHECK_ERR(lynIpeSetResizeConfig(m_oConfigDesc, m_iModelWidth, m_iModelHeight));
        CHECK_ERR(lynIpeCalOutputPicDesc(m_oPicDescOut, m_oPicDescIn, m_oConfigDesc, 2));
        CHECK_ERR(lynIpeSetOutputPicData(m_oPicDescOut, outputData));
        CHECK_ERR(lynIpeProcessAsync(stream, m_oPicDescIn, m_oPicDescOut, m_oConfigDesc));
    }

    virtual void SetImgInfo(int32_t width, int32_t height, lynPixelFormat_t format)
    {
        IpeParamBase::SetImgInfo(width, height, format);
    }
};
